<%@page import="camuyen.ltwlibrary.dao.BookDao"%>
<%@page import="camuyen.ltwlibrary.model.Book"%>
<%@page import="camuyen.ltwlibrary.model.Category"%>
<%@page import="java.util.List"%>
<%@page import="camuyen.ltwlibrary.dao.CategoryDao"%>
<%@ page import="camuyen.ltwlibrary.model.User"%>
<%@page import="camuyen.ltwlibrary.util.ServletUtil"%>
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    <title>Library</title>
    <jsp:include page="/incl/page.script.jsp" flush="true"/>
    <jsp:include page="/incl/page.bootstrap.jsp" flush="true"/>
    <jsp:include page="/incl/page.css.jsp" flush="true"/>
    
    <script type="text/javascript"
	src="${pageContext.request.contextPath}/resources/js/index.js"></script>
</head>
<body>
<div class="container">
    <div class="row-fluid">
        <div class="col-md-12" style="height: 120px;">
            <jsp:include page="/incl/page.loginform.jsp" flush="true"/>
        </div>
    </div>
    <jsp:include page="/incl/page.navigation.jsp" flush="true"/>
    <div class="row-fluid">
        <div class="col-md-3" style="padding-left: 0px">
            <ul class="list-group">
            	<% List<Category> allCategory = CategoryDao.getAll(); 
            		for (Category cat: allCategory) {
            	%>
                <li class="list-group-item cat-<%=cat.getCategoryId()%>"><%=cat.getCategoryName()%></li>
				<%} %>
            </ul>
        </div>
        <div class="col-md-9" style="padding-left: 0px; padding-right: 0px">
            <ul id="topBookTab" class="nav nav-tabs">
                <li class="active"><a href="#new" data-toggle="tab">New</a></li>
                <li><a href="#view" data-toggle="tab">Top View</a></li>
                <li><a href="#download" data-toggle="tab">Top Download</a></li>
            </ul>
            <div class="panel panel-default tab-content" style="border-top: none; border-radius: 0 0 4px 4px">
                <div class="panel-body tab-pane active" id="new">
                    <table style="width: 100%;">
						<% List<Book> allBook = BookDao.getAll();
						for (Book b: allBook) {
						%>
						<tr>
                            <td style="width: 180px"><div class="thumbnail" style="margin-bottom: 2"><img src="${pageContext.request.contextPath}/resources/images/thumbnail.png" alt="Book cover"/></div></td>
                            <td style="padding-left: 10px; vertical-align: top; ">
                                <a href="#"><h4><%=b.getTitle() %></h4></a>
                                <p class="author">Author: <%=b.getAuthors().get(0).getAuthorName() %></p>
                                <p class="description"><%=b.getSummary() %></p>
                                <span>Views: 43212</span>
                                <button type="button" class="btn btn-default">Download</button>
                            </td>
                        </tr>
						<%} %>
                    </table>
                </div>
                <div class="panel-body tab-pane" id="view">
                    Sauron, the Dark Lord, has gathered to him the Rings of Power - the means by which he will be able to rule the world. All he lacks in his plan for domination is the Ruling Ring, which has fallen into the hands of the hobbit Bilbo Baggins.
                </div>
                <div class="panel-body tab-pane" id="download">
                    "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>